home *** CD-ROM | disk | FTP | other *** search
/ Champak 141 / (Vol 141) Oct 17 2011.iso / Games / gamma-bros.swf / scripts / __Packages / classes / enemy / SpaceManB.as < prev   
Encoding:
Text File  |  2011-10-17  |  27.8 KB  |  895 lines

  1. class classes.enemy.SpaceManB
  2. {
  3.    var x;
  4.    var y;
  5.    var moveScript;
  6.    var matrixCoords;
  7.    var form;
  8.    var id;
  9.    var clip;
  10.    var colorR;
  11.    var trans;
  12.    var colorTrans;
  13.    var advanceMax;
  14.    var advanceMax2;
  15.    var matrixVar;
  16.    var laser;
  17.    var dir;
  18.    var axis;
  19.    var xDest;
  20.    var yDest;
  21.    var oldDir;
  22.    var cMax;
  23.    var xMov = 0;
  24.    var yMov = 0;
  25.    var xMovT = 0;
  26.    var yMovT = 0;
  27.    var speedOrig = 10;
  28.    var speed = 10;
  29.    var f2 = "";
  30.    var xDestMet = false;
  31.    var yDestMet = false;
  32.    var c = 0;
  33.    var moveScripted = true;
  34.    var feelerInfo = [[-400,0,400,40],[0,0,400,40],[0,-400,40,400],[0,0,40,400]];
  35.    var dirArray = ["L","R","U","D"];
  36.    var life = 425;
  37.    var nudging = false;
  38.    var nc = 0;
  39.    var xA = 0;
  40.    var yA = 0;
  41.    var power = 30;
  42.    var hc = 0;
  43.    var Name = "spaceManB";
  44.    function SpaceManB(px, py, pmoveScript, pmatrixCoords, pform, pid)
  45.    {
  46.       this.x = px;
  47.       this.y = py;
  48.       this.moveScript = pmoveScript.slice();
  49.       this.matrixCoords = pmatrixCoords.slice();
  50.       this.form = pform.slice();
  51.       this.id = pid;
  52.       _root.d = _root.d + 1;
  53.       this.clip = _root.attachMovie("spaceManB","spaceManB" + this.id + "Clip",_root.d + 50000);
  54.       this.clip._x = this.x;
  55.       this.clip._y = this.y;
  56.       this.speed *= _root.dif.speed;
  57.       this.speedOrig = this.speed;
  58.       this.life *= _root.dif.life;
  59.       this.colorR = _root.randRange(-40,10);
  60.       this.trans = new flash.geom.Transform(this.clip.body);
  61.       this.colorTrans = new flash.geom.ColorTransform(1,1,1,1,this.colorR,this.colorR,this.colorR,0);
  62.       this.trans.colorTransform = this.colorTrans;
  63.       this.advanceMax = 60 / (this.speed / 2);
  64.       this.advanceMax2 = 50 / (this.speed / 2);
  65.       if(this.matrixCoords[0] == "free")
  66.       {
  67.          this.matrixVar = 0;
  68.       }
  69.       else
  70.       {
  71.          this.matrixVar = 1;
  72.       }
  73.       this.speedVar();
  74.       this.laser = new Object();
  75.       this.parseMoveScript();
  76.       _root.stats.created = _root.stats.created + 1;
  77.       _root.sm = _root.sm + 1;
  78.       if(_root.sm == 2)
  79.       {
  80.          this.clip.body.head.eyes.clip.gotoAndStop(2);
  81.          delete _root.sm;
  82.       }
  83.    }
  84.    function broBehind()
  85.    {
  86.       this.dir = _root.advanceDir;
  87.    }
  88.    function bombed(num)
  89.    {
  90.       this.nudge(_root.randRange(-6,6),_root.randRange(-6,6),100);
  91.    }
  92.    function nudge(pxA, pyA, pscale)
  93.    {
  94.       this.nc = 0;
  95.       this.nudging = true;
  96.       var _loc2_ = pscale / 100;
  97.       this.xA = pxA * _loc2_;
  98.       this.yA = pyA * _loc2_;
  99.    }
  100.    function speedVar()
  101.    {
  102.       if(random(3) == 1)
  103.       {
  104.          this.speed *= _root.randRange2(0.9999,1.0001);
  105.       }
  106.    }
  107.    function parseMoveScript()
  108.    {
  109.       this.dir = this.moveScript[0];
  110.       if(this.dir == "break")
  111.       {
  112.          this.moveScripted = false;
  113.          delete this.moveScript;
  114.          if(this.matrixCoords[0] == "free")
  115.          {
  116.             this.f2 = "wander";
  117.             this[this.axis + "MovT"] = 0;
  118.             this.axis = random(10) <= 4 ? "y" : "x";
  119.             this[this.axis + "MovT"] = random(2) <= 0 ? -1 * this.speed : this.speed;
  120.             this.speedVar();
  121.             this.getDirString();
  122.          }
  123.          else
  124.          {
  125.             this[this.axis + "MovT"] = 0;
  126.             this.xDest = _root.advanceDir != "L" ? this.matrixCoords[0] * 60 : this.matrixCoords[0] * 60 + 320;
  127.             this.yDest = this.matrixCoords[1] * 50 + 10;
  128.             this.axis = Math.abs(this.xDest - this.x) <= Math.abs(this.yDest - this.y) ? "y" : "x";
  129.             this[this.axis + "MovT"] = this[this.axis + "Dest"] <= this[this.axis] ? -1 * this.speed : this.speed;
  130.             this.getDirString();
  131.             this.speedVar();
  132.             this.f2 = "gotoMatrix";
  133.          }
  134.       }
  135.       else
  136.       {
  137.          this[this.axis + "MovT"] = 0;
  138.          this.f2 = "gotoXYDest";
  139.          this.axis = !(this.dir == "L" || this.dir == "R") ? "y" : "x";
  140.          this[this.axis + "MovT"] = !(this.dir == "L" || this.dir == "U") ? this.speed : -1 * this.speed;
  141.          this.speedVar();
  142.          if(this.dir == "L" || this.dir == "U")
  143.          {
  144.             this[this.axis + "Dest"] = this[this.axis] - this.moveScript[1];
  145.          }
  146.          else
  147.          {
  148.             this[this.axis + "Dest"] = this[this.axis] + this.moveScript[1];
  149.          }
  150.          this.moveScript.splice(0,2);
  151.       }
  152.    }
  153.    function gotoXYDest()
  154.    {
  155.       if(Math.abs(this[this.axis + "Dest"] - this[this.axis]) < this.speed + 1)
  156.       {
  157.          if(this.axis == "x")
  158.          {
  159.             this.x = this.xDest;
  160.          }
  161.          else
  162.          {
  163.             this.y = this.yDest;
  164.          }
  165.          this.parseMoveScript();
  166.       }
  167.    }
  168.    function gotoMatrix()
  169.    {
  170.       if(Math.abs(this[this.axis + "Dest"] - this[this.axis]) < this.speed + 1)
  171.       {
  172.          if(this.axis == "x")
  173.          {
  174.             this.x = this.xDest;
  175.          }
  176.          else
  177.          {
  178.             this.y = this.yDest;
  179.          }
  180.          this[this.axis + "MovT"] = 0;
  181.          this.axis = this.axis != "x" ? "x" : "y";
  182.          this[this.axis + "MovT"] = this[this.axis + "Dest"] <= this[this.axis] ? -1 * this.speed : this.speed;
  183.          this.getDirString();
  184.          this.speed = this.speedOrig;
  185.       }
  186.       if(Math.abs(this.x - this.xDest) < this.speed + 1 && Math.abs(this.y - this.yDest) < this.speed + 1)
  187.       {
  188.          this.x = this.clip._x = this.xDest;
  189.          this.y = this.clip._y = this.yDest;
  190.          this.xMovT = this.xMov = 0;
  191.          this.yMovT = this.yMov = 0;
  192.          this.matrixVar = 2;
  193.          this.dir = _root.advanceDir;
  194.          this.clip.body.gotoAndPlay("flyEnd");
  195.          this.clip.flame.gotoAndStop("wait");
  196.          this.clip.gotoAndStop(this.dir);
  197.          this.oldDir = "matrix";
  198.          _root.matrixNum = _root.matrixNum + 1;
  199.          if(_root.matrixNum >= _root.matrixSize)
  200.          {
  201.             _root.matrixComplete = true;
  202.          }
  203.          _root["formB" + this.form[0]] = "matrixed";
  204.          this.f2 = "wait";
  205.       }
  206.    }
  207.    function getDirString()
  208.    {
  209.       if(this.xMovT < -1)
  210.       {
  211.          this.dir = "L";
  212.       }
  213.       else if(this.xMovT > 1)
  214.       {
  215.          this.dir = "R";
  216.       }
  217.       else if(this.yMovT > 1)
  218.       {
  219.          this.dir = "D";
  220.       }
  221.       else if(this.yMovT < -1)
  222.       {
  223.          this.dir = "U";
  224.       }
  225.    }
  226.    function evade()
  227.    {
  228.       if(this.matrixVar == 2)
  229.       {
  230.          this.matrixVar = 0;
  231.          this.clip.flame.gotoAndPlay("flyStart");
  232.          this.clip.body.gotoAndPlay("flyStart");
  233.          this.f2 = "wander";
  234.       }
  235.       else if(this.f2 == "charging")
  236.       {
  237.          this.newChargeDir();
  238.       }
  239.       else if(this.f2 == "laserScoping" || this.laser.firing)
  240.       {
  241.          this.stopLaserFire();
  242.       }
  243.    }
  244.    function wait()
  245.    {
  246.       if(random(1000) >= 998 && _root.matrixComplete)
  247.       {
  248.          this.dir = this.findDir();
  249.          if(this.dir == _root.advanceDir)
  250.          {
  251.             this.matrixVar = 0;
  252.             this.xMovT = _root.advanceDir != "L" ? this.speed : -1 * this.speed;
  253.             if(random(2) > 0)
  254.             {
  255.                this.clip.flame.gotoAndPlay("flyStart");
  256.                this.clip.body.gotoAndPlay("flyStart");
  257.                this.f2 = "wander";
  258.             }
  259.             else
  260.             {
  261.                this.charge();
  262.             }
  263.          }
  264.          else if(this.dir == "U" || this.dir == "D")
  265.          {
  266.             this.axis = !(this.dir == "L" || this.dir == "R") ? "y" : "x";
  267.             this[this.axis + "MovT"] = !(this.dir == "L" || this.dir == "U") ? this.speed : -1 * this.speed;
  268.             this.matrixVar = 0;
  269.             this.c = 0;
  270.             this.f2 = "leavingMatrix";
  271.          }
  272.          else
  273.          {
  274.             this.dir = _root.advanceDir;
  275.          }
  276.       }
  277.    }
  278.    function leavingMatrix()
  279.    {
  280.       this.c = this.c + 1;
  281.       if(this.c > this.advanceMax2)
  282.       {
  283.          this.c = 0;
  284.          this.dir = this.findDir();
  285.          if(this.dir == _root.advanceDir)
  286.          {
  287.             this.yMovT = 0;
  288.             this.xMovT = _root.advanceDir != "L" ? this.speed : -1 * this.speed;
  289.             if(random(2) > 0)
  290.             {
  291.                this.f2 = "wander";
  292.             }
  293.             else
  294.             {
  295.                this.charge();
  296.             }
  297.          }
  298.       }
  299.    }
  300.    function findDir()
  301.    {
  302.       _root.d = _root.d + 1;
  303.       _root.attachMovie("feeler","feelerClip",_root.d);
  304.       var _loc7_ = [];
  305.       var _loc9_ = 0;
  306.       var _loc11_ = this.dirArray.length;
  307.       while(_loc9_ < _loc11_)
  308.       {
  309.          _root.feelerClip._x = this.x + this.feelerInfo[_loc9_][0];
  310.          _root.feelerClip._y = this.y + this.feelerInfo[_loc9_][1];
  311.          _root.feelerClip._width = this.feelerInfo[_loc9_][2];
  312.          _root.feelerClip._height = this.feelerInfo[_loc9_][3];
  313.          var _loc3_ = 0;
  314.          var _loc8_ = _root.chars.length;
  315.          var _loc6_ = false;
  316.          while(_loc3_ < _loc8_)
  317.          {
  318.             var _loc5_ = _root.chars[_loc3_] + "Clip";
  319.             if(_root.feelerClip.hitTest(_root[_loc5_]))
  320.             {
  321.                var _loc4_ = _root.chars[_loc3_];
  322.                if(_root[_loc4_].matrixVar == 2 && _loc4_ != this.Name + this.id)
  323.                {
  324.                   _loc6_ = true;
  325.                   break;
  326.                }
  327.             }
  328.             _loc3_ = _loc3_ + 1;
  329.          }
  330.          if(!_loc6_)
  331.          {
  332.             var _loc10_ = _root.advanceDir != "L" ? "L" : "R";
  333.             if(this.dirArray[_loc9_] != _loc10_)
  334.             {
  335.                _loc7_.push(this.dirArray[_loc9_]);
  336.             }
  337.          }
  338.          _loc9_ = _loc9_ + 1;
  339.       }
  340.       _loc9_ = 0;
  341.       _loc11_ = _loc7_.length;
  342.       if(_loc9_ < _loc11_)
  343.       {
  344.          if(_loc7_[_loc9_] == _root.advanceDir)
  345.          {
  346.             return _root.advanceDir;
  347.          }
  348.          return _loc7_[random(_loc7_.length)];
  349.       }
  350.    }
  351.    function death()
  352.    {
  353.       _root.stats.destroyed = _root.stats.destroyed + 1;
  354.       _root.stats.score += 75000;
  355.       _root.powerUp(this.x,this.y,1);
  356.       if(this.matrixVar == 1)
  357.       {
  358.          _root.matrixNum = _root.matrixNum + 1;
  359.          if(_root.matrixNum >= _root.matrixSize)
  360.          {
  361.             _root.matrixComplete = true;
  362.          }
  363.       }
  364.       var _loc3_ = 0;
  365.       var _loc4_ = _root["form" + this.form[0]].length;
  366.       while(_loc3_ < _loc4_)
  367.       {
  368.          if(_root["form" + this.form[0]][_loc3_] == "spaceManB" + this.id)
  369.          {
  370.             _root["form" + this.form[0]].splice(_loc3_,1);
  371.             if(_root["form" + this.form[0]].length == 0)
  372.             {
  373.                delete _root["form" + this.form[0]];
  374.                if(_root["formB" + this.form[0]] == "matrixed")
  375.                {
  376.                   _loc3_ = 0;
  377.                   _loc4_ = random(3) + 2;
  378.                   while(_loc3_ < _loc4_)
  379.                   {
  380.                      _root.createPowerUp([this.x,this.y,"coin25"]);
  381.                      _loc3_ = _loc3_ + 1;
  382.                   }
  383.                   _loc3_ = 0;
  384.                   _loc4_ = random(3) + 2;
  385.                   while(_loc3_ < _loc4_)
  386.                   {
  387.                      _root.createPowerUp([this.x,this.y,"coin10"]);
  388.                      _loc3_ = _loc3_ + 1;
  389.                   }
  390.                   _loc3_ = 0;
  391.                   _loc4_ = random(3) + 2;
  392.                   while(_loc3_ < _loc4_)
  393.                   {
  394.                      _root.createPowerUp([this.x,this.y,"coin5"]);
  395.                      _loc3_ = _loc3_ + 1;
  396.                   }
  397.                   _root.stats.score += 50000;
  398.                }
  399.                else
  400.                {
  401.                   _loc3_ = 0;
  402.                   _loc4_ = random(3) + 2;
  403.                   while(_loc3_ < _loc4_)
  404.                   {
  405.                      _root.createPowerUp([this.x,this.y,"coin25"]);
  406.                      _loc3_ = _loc3_ + 1;
  407.                   }
  408.                   _loc3_ = 0;
  409.                   _loc4_ = random(5) + 2;
  410.                   while(_loc3_ < _loc4_)
  411.                   {
  412.                      _root.createPowerUp([this.x,this.y,"coin10"]);
  413.                      _loc3_ = _loc3_ + 1;
  414.                   }
  415.                   _root.stats.score += 100000;
  416.                }
  417.                delete _root["formB" + this.form[0]];
  418.             }
  419.             break;
  420.          }
  421.          _loc3_ = _loc3_ + 1;
  422.       }
  423.       _root.createExploA([this.x + this.clip._width / 2 + _root.randRange(-20,20),this.y + this.clip._height / 2 + _root.randRange(-20,20),_root.randRange(80,130),_root.randRange(75,100),"Red"]);
  424.       _root.createExploA([this.x + this.clip._width / 2 + _root.randRange(-20,20),this.y + this.clip._height / 2 + _root.randRange(-20,20),_root.randRange(80,130),_root.randRange(75,100),"Green"]);
  425.       _root.createExploA([this.x + this.clip._width / 2 + _root.randRange(-20,20),this.y + this.clip._height / 2 + _root.randRange(-20,20),_root.randRange(80,130),_root.randRange(75,100),"Blue"]);
  426.       _root.audio.playLevel4("spaceManX" + (random(3) + 1),_root.randRange(15,25));
  427.       var _loc5_ = 0;
  428.       var _loc6_ = random(4) + 3;
  429.       while(_loc5_ < _loc6_)
  430.       {
  431.          _root.createShrapnel([this.x + this.clip._width / 2,this.y + this.clip._height / 2,"spaceManB","Yellow"]);
  432.          _loc5_ = _loc5_ + 1;
  433.       }
  434.       _root.createEnemySoul([this.x + this.clip._width / 2,this.y + this.clip._height / 2,"red"]);
  435.       _root.removeChar("spaceManB" + this.id);
  436.    }
  437.    function advance()
  438.    {
  439.       this.dir = _root.advanceDir;
  440.       this.xMovT = _root.advanceDir != "L" ? 1 * (this.speed / 2) : -1 * (this.speed / 2);
  441.       this.clip.flame.gotoAndPlay("advance");
  442.       this.f2 = "advancing";
  443.    }
  444.    function advancing()
  445.    {
  446.       this.c = this.c + 1;
  447.       if(this.c > this.advanceMax)
  448.       {
  449.          this.xMovT = 0;
  450.          this.c = 0;
  451.          this.f2 = "wait";
  452.          _root.d = _root.d + 1;
  453.          _root.attachMovie("sight","sightClip",_root.d);
  454.          _root.sightClip.gotoAndStop("hindSight");
  455.          _root.sightClip._x = this.x;
  456.          _root.sightClip._y = this.y;
  457.          if(_root.advanceDir == "L")
  458.          {
  459.             _root.sightClip._rotation = 180;
  460.          }
  461.          if(_root.sightClip.hitTest(_root[_root.char].x,_root[_root.char].y,true))
  462.          {
  463.             _root.broBehind();
  464.          }
  465.          removeMovieClip(_root.sightClip);
  466.       }
  467.    }
  468.    function newDir()
  469.    {
  470.       if(random(10) > 1)
  471.       {
  472.          this[this.axis + "MovT"] = 0;
  473.          this.dir = _root.getDir(this.x,this.y);
  474.          this.axis = !(this.dir == "L" || this.dir == "R") ? "y" : "x";
  475.          this[this.axis + "MovT"] = !(this.dir == "L" || this.dir == "U") ? this.speed : -1 * this.speed;
  476.       }
  477.       else
  478.       {
  479.          this[this.axis + "MovT"] = 0;
  480.          this.axis = random(10) <= 4 ? "y" : "x";
  481.          this[this.axis + "MovT"] = random(2) <= 0 ? -1 * this.speed : this.speed;
  482.          this.getDirString();
  483.       }
  484.    }
  485.    function newChargeDir()
  486.    {
  487.       if(random(10) > 1)
  488.       {
  489.          this.dir = _root.getDir(this.x,this.y);
  490.       }
  491.       else
  492.       {
  493.          this.dir = this.dirArray[random(4)];
  494.       }
  495.    }
  496.    function wander()
  497.    {
  498.       if(random(100) > 93 + _root.dif.wander)
  499.       {
  500.          this.newDir();
  501.       }
  502.       else if(random(100) > 95)
  503.       {
  504.          if(this.dir == "U" || this.dir == "D")
  505.          {
  506.             this.laserScope();
  507.          }
  508.          else if(random(10) > 6)
  509.          {
  510.             this.charge();
  511.          }
  512.       }
  513.    }
  514.    function charge()
  515.    {
  516.       this.clip.body.gotoAndPlay("chargeStart");
  517.       this.clip.flame.gotoAndPlay("charge");
  518.       this.speed = this.speedOrig;
  519.       this.speed *= 1.5;
  520.       this.axis = "x";
  521.       this.yMovT = 0;
  522.       this[this.axis + "MovT"] = this.dir != "L" ? this.speed : -1 * this.speed;
  523.       this.f2 = "charging";
  524.       this.c = 0;
  525.       this.cMax = _root.randRange(30,120);
  526.       _root.audio.playLevel3("spaceManCharge",_root.randRange(25,35));
  527.    }
  528.    function charging()
  529.    {
  530.       if(random(100) > 93)
  531.       {
  532.          this.newChargeDir();
  533.       }
  534.       this.c = this.c + 1;
  535.       if(this.c == this.cMax)
  536.       {
  537.          this.clip.body.gotoAndPlay("chargeEnd");
  538.          this.clip.flame.gotoAndPlay("fly");
  539.          this.speed = this.speedOrig;
  540.          this[this.axis + "MovT"] = this.dir != "L" ? this.speed : -1 * this.speed;
  541.          this.f2 = "wander";
  542.       }
  543.    }
  544.    function laserScope()
  545.    {
  546.       this.laser.c = 0;
  547.       this.laser.c2 = 0;
  548.       this.laser.c2Max = _root.randRange(2,4);
  549.       this.f2 = "laserScoping";
  550.       this.speed /= 3;
  551.       this[this.axis + "MovT"] /= 3;
  552.       this.clip.body.head.gotoAndPlay("scope");
  553.       this.clip.body.gotoAndStop("hover");
  554.       _root.audio.playLevel2("spaceManWarning" + (random(3) + 1),_root.randRange(43,50));
  555.    }
  556.    function laserScoping()
  557.    {
  558.       this.laser.c = this.laser.c + 1;
  559.       if(this.laser.c == 20)
  560.       {
  561.          this.laser.c2 = this.laser.c2 + 1;
  562.          _root.d = _root.d + 1;
  563.          _root.attachMovie("sight","sightClip",_root.d);
  564.          _root.sightClip.gotoAndStop("bomberBLaser");
  565.          _root.sightClip._x = this.x;
  566.          _root.sightClip._y = this.y;
  567.          if(_root.sightClip.hitTest(_root[_root.char].x,_root[_root.char].y,true))
  568.          {
  569.             this.laser.dir = "L";
  570.             this.fireLaser(false);
  571.          }
  572.          else
  573.          {
  574.             _root.sightClip._rotation = 180;
  575.             if(_root.sightClip.hitTest(_root[_root.char].x,_root[_root.char].y,true))
  576.             {
  577.                this.laser.dir = "R";
  578.                this.fireLaser(false);
  579.             }
  580.          }
  581.          removeMovieClip(_root.sightClip);
  582.          this.laser.c = 0;
  583.       }
  584.       else if(this.laser.c2 >= this.laser.c2Max)
  585.       {
  586.          this.speed = this.speedOrig;
  587.          this[this.axis + "MovT"] *= 3;
  588.          this.f2 = "wander";
  589.          this.clip.body.head.gotoAndPlay("front");
  590.       }
  591.    }
  592.    function fireLaser(pmatrixed)
  593.    {
  594.       this.clip.gotoAndStop(this.laser.dir);
  595.       this.clip.body.head.gotoAndStop("front");
  596.       this.laser.matrixed = pmatrixed;
  597.       this.f2 = "";
  598.       this.clip.body.head.eyes.gotoAndPlay("glowStart");
  599.       this.clip.body.hover.gotoAndPlay("topStart");
  600.       this.laser.l = _root.randRange(10,30);
  601.       this.laser.l *= _root.dif.speed;
  602.       this.laser.firing = true;
  603.       this.laser.top = true;
  604.       this.laser.c = 0;
  605.    }
  606.    function stopLaserFire()
  607.    {
  608.       this.laser.firing = false;
  609.       this.clip.body.head.eyes.gotoAndPlay("glowEnd");
  610.       if(this.laser.top)
  611.       {
  612.          this.clip.body.hover.gotoAndPlay("topEnd");
  613.       }
  614.       else
  615.       {
  616.          this.clip.body.hover.gotoAndPlay("botEnd");
  617.       }
  618.       if(!this.laser.matrixed)
  619.       {
  620.          this.speed = this.speedOrig;
  621.          this[this.axis + "MovT"] *= 3;
  622.          this.f2 = "wander";
  623.       }
  624.    }
  625.    function death2()
  626.    {
  627.       _root.removeChar("spaceManB" + this.id);
  628.    }
  629.    function main()
  630.    {
  631.       this[this.f2]();
  632.       if(this.oldDir != this.dir)
  633.       {
  634.          if(this.f2 != "charging" && this.oldDir != "matrix")
  635.          {
  636.             this.clip.gotoAndStop(this.dir);
  637.             if(this.dir == "U")
  638.             {
  639.                this.clip.body.gotoAndPlay("flyEnd");
  640.                this.clip.flame.gotoAndPlay("up2");
  641.             }
  642.             else if(this.dir == "D")
  643.             {
  644.                this.clip.body.gotoAndPlay("flyEnd");
  645.                this.clip.flame.gotoAndStop("wait");
  646.             }
  647.             else if(this.f2 != "wait")
  648.             {
  649.                this.clip.body.gotoAndPlay("flyStart");
  650.                this.clip.flame.gotoAndPlay("fly");
  651.             }
  652.          }
  653.          else if(this.oldDir != "matrix")
  654.          {
  655.             this.clip.gotoAndStop(this.dir);
  656.             if(this.oldDir == "L" || this.oldDir == "R")
  657.             {
  658.                if(this.dir == "U")
  659.                {
  660.                   this.axis = "y";
  661.                   this.yMovT = -1 * this.speed;
  662.                   this.clip.body.gotoAndPlay("upStart");
  663.                   this.clip.flame.gotoAndPlay("upStart");
  664.                }
  665.                else if(this.dir == "D")
  666.                {
  667.                   this.axis = "y";
  668.                   this.yMovT = this.speed;
  669.                   this.clip.body.gotoAndPlay("downStart");
  670.                   this.clip.flame.gotoAndPlay("downStart");
  671.                }
  672.                else
  673.                {
  674.                   this.axis = "x";
  675.                   this.yMovT = 0;
  676.                   this.xMovT = this.dir != "L" ? this.speed : -1 * this.speed;
  677.                   this.clip.body.gotoAndPlay("chargeStart");
  678.                   this.clip.flame.gotoAndPlay("charge");
  679.                }
  680.             }
  681.             else if(this.dir == "U")
  682.             {
  683.                this.axis = "y";
  684.                this.xMovT = 0;
  685.                this.clip.body.gotoAndPlay("hover");
  686.                this.clip.flame.gotoAndPlay("up2");
  687.             }
  688.             else if(this.dir == "D")
  689.             {
  690.                this.axis = "y";
  691.                this.xMovT = 0;
  692.                this.clip.body.gotoAndPlay("downStart");
  693.                this.clip.flame.gotoAndPlay("downStart");
  694.             }
  695.             else
  696.             {
  697.                this.axis = "x";
  698.                this.xMovT = this.dir != "L" ? this.speed : -1 * this.speed;
  699.                if(this.oldDir == "U")
  700.                {
  701.                   this.clip.body.gotoAndPlay("upStart");
  702.                   this.clip.flame.gotoAndPlay("upStart");
  703.                }
  704.                else
  705.                {
  706.                   this.clip.body.gotoAndPlay("downStart");
  707.                   this.clip.flame.gotoAndPlay("downStart");
  708.                }
  709.             }
  710.          }
  711.       }
  712.       this.oldDir = this.dir;
  713.       if(this.laser.firing)
  714.       {
  715.          this.laser.c = this.laser.c + 1;
  716.          if(this.laser.c / 4 == Math.round(this.laser.c / 4))
  717.          {
  718.             if(this.laser.top)
  719.             {
  720.                this.laser.top = false;
  721.                this.clip.body.hover.gotoAndPlay("topToBot");
  722.                var _loc10_ = this.laser.dir != "L" ? -9 : -8;
  723.                _root.enemyShotID = _root.enemyShotID + 1;
  724.                _root["spaceManBLaser" + _root.enemyShotID] = new classes.shots.SpaceManBLaser(this.x + _loc10_,this.y + 6,this.laser.c,this.laser.dir,_root.enemyShotID);
  725.                _root.addEnemyShot("spaceManBLaser" + _root.enemyShotID);
  726.             }
  727.             else
  728.             {
  729.                this.laser.top = true;
  730.                this.clip.body.hover.gotoAndPlay("botToTop");
  731.                _loc10_ = this.laser.dir != "L" ? 9 : -8;
  732.                _root.enemyShotID = _root.enemyShotID + 1;
  733.                _root["spaceManBLaser" + _root.enemyShotID] = new classes.shots.SpaceManBLaser(this.x + _loc10_,this.y + 9,this.laser.c,this.laser.dir,_root.enemyShotID);
  734.                _root.addEnemyShot("spaceManBLaser" + _root.enemyShotID);
  735.             }
  736.             _root.audio.playLevel3("spaceManFire" + (random(5) + 1),_root.randRange(15,25));
  737.          }
  738.          if(this.laser.c > this.laser.l)
  739.          {
  740.             this.stopLaserFire();
  741.          }
  742.       }
  743.       if(this.nudging)
  744.       {
  745.          this.xA *= 0.5;
  746.          this.yA *= 0.5;
  747.          this.nc = this.nc + 1;
  748.          var _loc9_ = 255 - this.nc * 17;
  749.          this.colorTrans.redOffset = _loc9_;
  750.          this.colorTrans.greenOffset = _loc9_;
  751.          this.trans.colorTransform = this.colorTrans;
  752.          if(this.nc == 15)
  753.          {
  754.             this.xA = this.yA = 0;
  755.             this.nudging = false;
  756.             this.colorTrans.redOffset = this.colorR;
  757.             this.colorTrans.greenOffset = this.colorR;
  758.             this.trans.colorTransform = this.colorTrans;
  759.          }
  760.       }
  761.       var _loc4_ = 0;
  762.       var _loc7_ = _root.broShots.length;
  763.       while(_loc4_ < _loc7_)
  764.       {
  765.          var _loc6_ = _root.broShots[_loc4_] + "Clip";
  766.          if(this.clip.hitTest(_root[_loc6_]))
  767.          {
  768.             var _loc3_ = _root.broShots[_loc4_];
  769.             var _loc5_ = this.life;
  770.             this.life -= _root[_loc3_].power;
  771.             if(this.life < 1 || this.life == NaN)
  772.             {
  773.                this.f2 = "death";
  774.             }
  775.             else
  776.             {
  777.                this.nudge(_root[_loc3_].xMov,_root[_loc3_].yMov,5);
  778.                if(random(3) == 0)
  779.                {
  780.                   _root.audio.playLevel4("spaceManHit" + (random(3) + 1),_root.randRange(23,32));
  781.                }
  782.                else
  783.                {
  784.                   _root.audio.playLevel2("spaceManHit" + (random(2) + 4),_root.randRange(15,20));
  785.                }
  786.                if(this.f2 == "wait" || this.f2 == "advancing")
  787.                {
  788.                   this.matrixVar = 0;
  789.                   this.charge();
  790.                }
  791.                else if(this.f2 == "wander" || this.f2 == "laserScoping")
  792.                {
  793.                   if(random(2) == 0)
  794.                   {
  795.                      this.speed = this.speedOrig;
  796.                      this[this.axis + "MovT"] = 0;
  797.                      this.axis = this.axis != "x" ? "x" : "y";
  798.                      this[this.axis + "MovT"] = random(2) <= 0 ? -1 * this.speed : this.speed;
  799.                      this.getDirString();
  800.                   }
  801.                   else if(random(2) == 0)
  802.                   {
  803.                      this.axis = "x";
  804.                      this.dir = random(2) != 0 ? "R" : "L";
  805.                      this.charge();
  806.                   }
  807.                }
  808.                else if(this.f2 == "charging")
  809.                {
  810.                   this.newChargeDir();
  811.                }
  812.             }
  813.             _root[_root.char].fc = _root[_root.char].fireFreq - _root.rapidVar;
  814.             _root[_loc3_].exploX = this.x + this.clip._width / 2;
  815.             _root[_loc3_].exploY = this.y + this.clip._height / 2;
  816.             _root[_loc3_].hit(_loc5_);
  817.             break;
  818.          }
  819.          _loc4_ = _loc4_ + 1;
  820.       }
  821.       if(this.clip.hitTest(_root[_root.char + "Clip"]))
  822.       {
  823.          _root[_root.char].hit(this.xMov,this.yMov,100,this.power);
  824.          this.bombed(20);
  825.       }
  826.       if(!this.moveScripted)
  827.       {
  828.          var _loc8_ = false;
  829.          if(this.x > 950)
  830.          {
  831.             _loc8_ = true;
  832.             this.dir = "L";
  833.          }
  834.          else if(this.x < 50)
  835.          {
  836.             _loc8_ = true;
  837.             this.dir = "R";
  838.          }
  839.          else if(this.y < 50)
  840.          {
  841.             _loc8_ = true;
  842.             this.dir = "D";
  843.          }
  844.          else if(this.y > 550)
  845.          {
  846.             _loc8_ = true;
  847.             this.dir = "U";
  848.          }
  849.          if(_loc8_)
  850.          {
  851.             this.xMovT = 0;
  852.             this.yMovT = 0;
  853.             this.speed = this.speedOrig;
  854.             this.axis = !(this.dir == "L" || this.dir == "R") ? "y" : "x";
  855.             this[this.axis + "MovT"] = !(this.dir == "L" || this.dir == "U") ? this.speed : -1 * this.speed;
  856.             this.f2 = "wander";
  857.          }
  858.       }
  859.       if(this.x > 1500 || this.x < -500 || this.y < -500 || this.y > 1100)
  860.       {
  861.          delete _root["form" + this.form[0]];
  862.          delete _root["formB" + this.form[0]];
  863.          this.f2 = "death2";
  864.       }
  865.       if(this.xMovT < this.xMov)
  866.       {
  867.          this.xMov -= 0.75;
  868.       }
  869.       else if(this.xMovT > this.xMov)
  870.       {
  871.          this.xMov += 0.75;
  872.       }
  873.       else
  874.       {
  875.          this.xMov = this.xMovT;
  876.       }
  877.       if(this.yMovT < this.yMov)
  878.       {
  879.          this.yMov -= 0.75;
  880.       }
  881.       else if(this.yMovT > this.yMov)
  882.       {
  883.          this.yMov += 0.75;
  884.       }
  885.       else
  886.       {
  887.          this.yMov = this.yMovT;
  888.       }
  889.       this.x += this.xMov + this.xA;
  890.       this.y += this.yMov + this.yA + 0.5 * Math.sin(this.hc += 0.1);
  891.       this.clip._x = this.x;
  892.       this.clip._y = this.y;
  893.    }
  894. }
  895.